import request from '@/utils/request'

const api = {
  lists: '/t1/content/activity/lists',
  create: '/t1/content/activity/create',
  info: '/t1/content/activity/info',
  edit: '/t1/content/activity/edit',
  recall: '/t1/content/activity/recall',
  del: '/t1/content/activity/del'
}

/**
 * login func
 * parameter: {
 *     username: '',
 *     password: '',
 *     remember_me: true,
 *     captcha: '12345'
 * }
 * @param parameter
 * @returns {*}
 */
// 新闻和公告列表
export function lists (parameter) {
  return request({
    url: api.lists,
    method: 'get',
    params: parameter
  })
}

// 创建新闻或公告
export function create (parameter) {
  return request({
    url: api.create,
    method: 'post',
    data: parameter
  })
}

// 获取新闻或公告详情
export function info (parameter) {
  return request({
    url: api.info,
    method: 'get',
    params: parameter
  })
}

// 获取新闻或公告详情
export function edit (parameter) {
  return request({
    url: api.edit,
    method: 'post',
    data: parameter
  })
}

// 撤回公告或新闻
export function recall (parameter) {
  return request({
    url: api.recall,
    method: 'post',
    data: parameter
  })
}

// 删除公告或新闻
export function del (parameter) {
  return request({
    url: api.del,
    method: 'post',
    data: parameter
  })
}
